Skip to content

Host fine-tuned checkpoints on the HF Hub (D14) + evaluate.py --methods - #4

Open
seanmcgowanx wants to merge 1 commit into
mainfrom
sean/hf-checkpoints
Open

seanmcgowanx wants to merge 1 commit into
mainfrom
sean/hf-checkpoints

Conversation

@seanmcgowanx

Copy link
Copy Markdown
Collaborator

Why (D14)

Fine-tuned weights only existed on the machine that trained them, so the web app and evaluate.py silently fell back to pretrained weights for anyone else, and a grader cloning the repo couldn't reproduce the fine-tuned rows. The weights (~1 GB, mostly DDColor-L) are too big for git.

What

  • One public HF model repo (aai521-group3/aai521-restoration-checkpoints), one folder per training run mirroring $AAI521_DATA_ROOT/checkpoints/<run_name>/. Pinned in configs/models.yaml (finetuned.revision: cef1c87…) so later uploads can't change reported results.
  • scripts/upload_checkpoints.py: pushes best.safetensors / best_lora/, config.json, metrics.csv, summary.json + a generated model card in one commit. Never uploads last_state.pt. --tasks inpaint swaps in a single run (e.g. a better LoRA).
  • scripts/download_models.py: now also fetches the runs into the checkpoint root (--no-finetuned to skip; --models --finetuned for fine-tuned only). No loader code changed: the pipeline's existing <run_name>/best.safetensors lookup picks them up.
  • config.train_run_names(): run folder names come from configs/train/<task>.yaml, the same source the pipeline uses.
  • scripts/evaluate.py --methods: for denoise_inpaint, run only methods whose name contains the given string(s) and merge them into the existing CSV (replacing rows for those methods). Lets us add the fine-tuned BOPBtL rows (~2.4 h on MPS) without rerunning the zero-shot ones. Assumes the same --seed/--inpaint-limit as the existing CSV.

Verified

  • make test (94 passed), make lint (ruff + mypy clean)
  • AAI521_DATA_ROOT=/tmp/hfcheck python scripts/download_models.py --models --finetuned → all 4 runs (996 MB); SHA-256 of every weight file matches the trainer's local copies
  • RestorationPipeline loads all four tasks as fine-tuned (<run>)

Note: per D11 the inpaint LoRA is the step-0 adapter (identical to pretrained SD), so it's hosted for completeness, not because it changes outputs.

…-methods

- scripts/upload_checkpoints.py pushes each run's best weights, config, metrics and
  summary (never last_state.pt) plus a model card to one team HF repo
- download_models.py fetches those runs into $AAI521_DATA_ROOT/checkpoints
  (--finetuned/--no-finetuned), pinned to finetuned.revision in models.yaml
- config: FinetunedSpec and train_run_names() as the single source of run folder names
- evaluate.py --methods: rerun a subset of denoise_inpaint methods and merge the rows
  into the existing CSV, so the fine-tuned rows can be added without redoing zero-shot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant